package com.example.campus.mapper;

import com.example.campus.pojo.dto.CategoryAddDTO;
import com.example.campus.pojo.dto.CategoryPageQueryDTO;
import com.example.campus.pojo.entity.Category;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface CategoryMapper {

    Page<Category> getCategoryList(CategoryPageQueryDTO categoryPageQueryDTO);

    @Insert("insert into category (name, description)" +
            "values " +
            "(#{name}, #{description})")
    void addCategory(CategoryAddDTO categoryAddDTO);

    @Update("update category set name = #{name}, description = #{description} where id = #{id}")
    void updateCategory(Category category);

    @Delete("delete from category where id = #{id}")
    void deleteCategoryById(Long id);
}
